﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using DotNet.Common.Command.Config;
using DotNet.Common.Command;
using ZLCMS.Business.Commands.SessionCommands.Template;
using ZLCMS.Business.Shop.Commands;
using ZLCMS.Business.Shop;



namespace ZLCMS.Web.Code
{
    public static class AjaxCommonCommand
    {
        public static void InitCommand(string filePath)
        {
            //命令配置
            CommandConfig.Config(filePath);



            ////接口初始化
            //DotNet.Common.Command.CommandFactory.Instance.RegisterBuilder("InterfaceExample", new DotNet.Common.Command.CommandInfo()
            //{
            //    CommandType = typeof(ZLCMS.Web.Wap.Example.InterfaceExampleCommand),
            //    ResultType = typeof(ZLCMS.Web.Wap.Example.InterfaceExampleResult),
            //    ParameterType = typeof(ZLCMS.Web.Wap.Example.InterfaceExampleParameter)
            //});

            //参数接口
            DotNet.Common.Command.CommandFactory.Instance.RegisterBuilder("LoadParameter", new DotNet.Common.Command.CommandInfo()
            {
                CommandType = typeof(ZLCMS.Business.Commands.LoadParameterCommand),
                ResultType = typeof(ICommandResult<object>),
                ParameterType = typeof(ZLCMS.Business.Commands.LoadParameterParameter)
            });

            //提交表单
            DotNet.Common.Command.CommandFactory.Instance.RegisterBuilder("SubmitForm", new DotNet.Common.Command.CommandInfo()
            {
                CommandType = typeof(ZLCMS.Business.Commands.SessionCommands.SubmitFormCommand),
                ResultType = typeof(ICommandResult<ZLCMS.Business.Commands.SessionCommands.SubmitFormResult>),
                ParameterType = typeof(ZLCMS.Business.Commands.SessionCommands.SubmitFormParameter)
            });


            //微信接口注册
            ZLCMS.Business.WeixinService.WeixinServiceCommandInstaller.Install();

            //商城接口注册
            ZLCMS.Business.Shop.ShopCommandInstaller.Install();
 

            ////会员
            //CommandFactory.Instance.RegisterBuilder("ExampleApply", new CommandInfo()
            //{
            //    CommandType = typeof(ExampleApplyCommand),
            //    ResultType = typeof(ExampleApplyResult),
            //    ParameterType = typeof(ExampleApplyParameter)
            //});

            ////地址信息
            //CommandFactory.Instance.RegisterBuilder("ExampleLoadList", new CommandInfo()
            //{
            //    CommandType = typeof(ExampleLoadListCommand),
            //    ResultType = typeof(ExampleLoadListResult),
            //    ParameterType = typeof(ExampleLoadListParameter)
            //});

            ////增加购物车
            //CommandFactory.Instance.RegisterBuilder("AddProductApply", new CommandInfo()
            //{
            //    CommandType = typeof(AddProductApplyCommand),
            //    ResultType = typeof(AddProductApplyResult),
            //    ParameterType = typeof(AddProductApplyParameter)
            //});
            ////移除商品
            //CommandFactory.Instance.RegisterBuilder("RemoveProductApply", new CommandInfo()
            //{
            //    CommandType = typeof(RemoveProductApplyCommand),
            //    ResultType = typeof(RemoveProductApplyResult),
            //    ParameterType = typeof(RemoveProductApplyParameter)
            //});

            ////更新商品数量
            //CommandFactory.Instance.RegisterBuilder("UpdateProductQuantityApply", new CommandInfo()
            //{
            //    CommandType = typeof(UpdateProductQuantityApplyCommand),
            //    ResultType = typeof(UpdateProductQuantityApplyResult),
            //    ParameterType = typeof(UpdateProductQuantityApplyParameter)
            //});

            ////增加商品数量
            //CommandFactory.Instance.RegisterBuilder("AddProductQuantityApply", new CommandInfo()
            //{
            //    CommandType = typeof(AddProductQuantityApplyCommand),
            //    ResultType = typeof(AddProductQuantityApplyResult),
            //    ParameterType = typeof(AddProductQuantityApplyParameter)
            //});
            //DotNet.Common.Command.CommandFactory.Instance.RegisterBuilder("ChinaPayGetCheckCode", new DotNet.Common.Command.CommandInfo()
            //{
            //    CommandType = typeof(ChinaPayGetCheckCodeCommand),
            //    ResultType = typeof(ICommandResult<ChinaPayGetCheckCodeResult>),
            //    ParameterType = typeof(ChinaPayGetCheckCodeParameter)
            //});
        }
    }
}
